<?php include template("header");?>
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<?php if($team['close_time']){?>
<div id="sysmsg-tip" class="sysmsg-tip-deal-close"><div class="sysmsg-tip-top"></div><div class="sysmsg-tip-content"><div class="deal-close"><div class="focus">Rất tiếc, Bạn đã trễ ...<br />Deal đã kết thúc</div><div id="tip-deal-subscribe-body" class="body"><form id="tip-deal-subscribe-form" method="post" action="/subscribe.php" class="validator"><table><tr><td>Đừng quên trở lại vào ngày mai nhé&nbsp;</td><td><input type="text" name="email" class="f-text" value="" require="true" datatype="email" /></td><td>&nbsp;<input class="commit" type="submit" value="Subscribe" /></td></tr></table></form></div></div><span id="sysmsg-tip-close" class="sysmsg-tip-close">close</span></div><div class="sysmsg-tip-bottom"></div></div>
<?php }?>
<?php if($order){?>
<div id="sysmsg-tip" ><div class="sysmsg-tip-top"></div><div class="sysmsg-tip-content">Bạn đã đặt mua sản phẩm này, nhưng chưa thanh toán .<a href="/order/check.php?id=<?php echo $order['id']; ?>">Kiểm tra ngay!</a><span id="sysmsg-tip-close" class="sysmsg-tip-close">Đóng</span></div><div class="sysmsg-tip-bottom"></div></div><div id="deal-default"> 
<?php }?>
	<div id="deal-default">
		<!--{//include block_team_share}-->
		<div id="content">
			<div id="deal-intro" class="cf">
                <h1><?php if($team['close_time']==0){?><a class="deal-today-link" href="/team.php?id=<?php echo $team['id']; ?>"><?php echo $city['name']; ?>: </a><?php }?><?php echo $team['title']; ?></h1>
                <div class="main">
                    <div class="deal-buy">
                        <div class="deal-price-tag"></div>
					<?php if(($team['state']=='soldout')){?>
                        <p class="deal-price"><strong><?php echo formatMoney($team['team_price'],0); ?><?php echo $currency; ?></strong></p>
					<?php } else if($team['close_time']) { ?>
                        <p class="deal-price"><strong><?php echo formatMoney($team['team_price'],0); ?><?php echo $currency; ?></strong><span style="margin-top: 34px;"><img width="100px" alt="" src="../static/css/i/bg-deal-expired-text.png"></span></p>
					<?php } else { ?>
                        <p class="deal-price"><strong><?php echo formatMoney($team['team_price'],0); ?><?php echo $currency; ?></strong><span><a <?php echo $team['begin_time']<time()?' href="/voucher/buy-'.$team['id'].'.html"':''; ?>><img src="/static/css/i/buy_btn.png" width="100px;" /></a></span></p>
					<?php }?>
                    </div>
					<table class="deal-discount" border=1>
                    	<tr><td colspan=2><br></br>Giá gốc<br><b style='text-decoration: line-through; font-size: 20px;'><?php echo formatMoney($team['market_price'],0); ?> <?php echo $currency; ?></b></td></tr>
                    	<tr><td>Giảm giá</td><td>Tiết kiệm</td></tr>
                        <tr>
							<td><?php echo formatMoney((100*($team['market_price'] - $team['team_price'])/$team['market_price']),1); ?>%</td>
                            <td><?php echo formatMoney($discount_price,0); ?></td>
                        </tr>
                    </table>
					<?php if($team['close_time']){?>
                    <div class="deal-box deal-timeleft deal-off" style="background: #e4f0f9" id="deal-timeleft" curtime="<?php echo $now; ?>000" diff="<?php echo $diff_time; ?>000">
						<h3>deal đóng lúc</h3>
						<div class="limitdate"><p class="deal-buy-ended"><?php echo date('d-m-Y', $team['close_time']); ?><br><?php echo date('H:i:s', $team['close_time']); ?></p></div>
					</div>
					<?php } else { ?>
                    <div class="deal-box deal-timeleft deal-on" id="deal-timeleft" curtime="<?php echo $now; ?>000" diff="<?php echo $diff_time; ?>000">
						<h3>Thời gian còn lại</h3>
						<div class="limitdate">
							<ul id="counter">
						<?php if($left_day>0){?>
							<li><span><?php echo $left_day; ?></span>Ngày</li><li><span><?php echo $left_hour; ?></span>giờ</li><li><span><?php echo $left_minute; ?></span>phút</li>
						<?php } else { ?>
							<li><span><?php echo $left_hour; ?></span>Giờ</li><li><span><?php echo $left_minute; ?></span>phút</li><li><span><?php echo $left_time; ?></span>giây</li>
						<?php }?>
							</ul>
						</div>
					</div>
					<?php }?>
				<?php if($team['close_time']==0){?>
					<?php if($team['state']=='none'){?>
					<div class="deal-box deal-status" id="deal-status">
						<p class="deal-buy-tip-top"><strong><?php echo $team['now_number']; ?></strong> Đã mua</p>
						<div class="progress-pointer" style="padding-left:<?php echo $bar_size-$bar_offset; ?>px;"><span></span></div>
						<div class="progress-bar"><div class="progress-left" style="width:<?php echo $bar_size-$bar_offset; ?>px;"></div><div class="progress-right "></div></div>
						<div class="cf"><div class="min">0</div><div class="max"><?php echo $team['min_number']; ?></div></div>
						<p class="deal-buy-tip-btm">Cần <strong><?php echo $team['min_number']-$team['now_number']; ?></strong> phiếu để đạt mức tối thiểu! </p>
					</div>
					<?php } else { ?>
					<div class="deal-box deal-status deal-status-open" id="deal-status">
						<p class="deal-buy-tip-top"><strong><?php echo $team['now_number']; ?></strong> Phiếu đã được mua</p>
					<?php if($team['max_number']&&$team['max_number']>$team['now_number']){?>
						<p class="deal-buy-tip-btm">Còn <strong><?php echo $team['max_number']-$team['now_number']; ?></strong> phiếu nữa</p>
					<?php }?>
						<p class="deal-buy-on" style="line-height:200%;"><img src="/static/css/i/deal-buy-succ.gif"/> vẫn còn mua được <?php if($team['max_number']>$team['now_number']||$team['max_number']==0){?><?php }?></p>
						<?php if($team['reach_time']){?>
						<p class="deal-buy-tip-btm">Minimum Buys to meet to Tip this Deal <strong><?php echo $team['min_number']; ?></strong> persons</p>
					<?php }?>
					 -->
					</div>
					<?php }?>
				<?php } else { ?>
					<div class="deal-box deal-status deal-status-<?php echo $team['state']; ?>" style="background: #e4f0f9;" id="deal-status"><div class="deal-buy-<?php echo $team['state']; ?>"></div><p class="deal-buy-tip-total">tổng cộng <strong><?php echo $team['now_number']; ?></strong> phiếu đã được mua</p></div> 
				<?php }?>
				</div>
                <div class="side">
                    <div class="deal-buy-cover-img" id="team_images">
					<?php if($team['image1']||$team['image2']){?>
						<div class="mid">
							<ul>
								<li class="first"><img src="<?php echo team_image($team['image']); ?>"/></li>
							<?php if($team['image1']){?>
								<li><img src="<?php echo team_image($team['image1']); ?>"/></li>
							<?php }?>
							<?php if($team['image2']){?>
								<li><img src="<?php echo team_image($team['image2']); ?>"/></li>
							<?php }?>
							<?php if($team['image3']){?>
								<li><img src="<?php echo team_image($team['image3']); ?>"/></li>
							<?php }?>
							<?php if($team['image3']){?>
								<li><img src="<?php echo team_image($team['image4']); ?>"/></li>
							<?php }?>
							</ul>
							<div id="img_list">
								<a ref="1" class="active">1</a>
							<?php $imageindex=1;; ?>
							<?php if($team['image1']){?>
								<a ref="<?php echo ++$imageindex; ?>" ><?php echo $imageindex; ?></a>
							<?php }?>
							<?php if($team['image2']){?>
								<a ref="<?php echo ++$imageindex; ?>" ><?php echo $imageindex; ?></a>
							<?php }?>
							<?php if($team['image3']){?>
								<a ref="<?php echo ++$imageindex; ?>" ><?php echo $imageindex; ?></a>
							<?php }?>
							<?php if($team['image4']){?>
								<a ref="<?php echo ++$imageindex; ?>" ><?php echo $imageindex; ?></a>
							<?php }?>														
							</div> 
						</div>
						<?php } else { ?>
							<img src="<?php echo team_image($team['image']); ?>" width="440" height="280" />
						<?php }?>
					</div>
				<?php if(strip_tags($team['summary'])!=$team['summary']){?><?php echo $team['summary']; ?><?php } else { ?><div style="line-height: 22px;text-align: justify;" class="digest"><br /><?php echo nl2br(strip_tags($team['summary'])); ?></div><?php }?>
                </div>
            </div>
            <div id="deal-stuff" class="cf">
                <div class="clear box <?php echo ($partner&&!option_yes('teamwhole'))?'box-split':''; ?>">
                    <div class="box-top"></div>
                    <div class="box-content cf">
                        <div class="main" id="team_main_side">
						<?php if(trim(strip_tags($team['detail']))){?>
                            <h2 id="detail">Chi tiết</h2>
							<div style="line-height: 22px" class="blk detail"><?php echo $team['detail']; ?></div>
						<?php }?>
						<?php if(trim(strip_tags($team['notice']))){?>
							<h2 id="detailit">Tips</h2>
							<div style="line-height: 22px" class="blk cf"><?php echo $team['notice']; ?></div>
						<?php }?>
						<?php if(trim(strip_tags($team['userreview']))){?>
							<h2 id="userreview">Reviews</h2>
							<div style="line-height: 22px" class="blk review"><?php echo userreview($team['userreview']); ?></div>
						<?php }?>
						<?php if(trim(strip_tags($team['systemreview']))){?>
							<h2 id="systemreview"><?php echo $INI['system']['abbreviation']; ?> Says</h2>
							<div class="blk review"><?php echo $team['systemreview']; ?></div>
						<?php }?>
						</div>

                        <div class="side" id="team_partner_side_<?php echo (!option_yes('teamwhole')&&abs(intval($partner['id'])))?1:0; ?>">
                            <div id="side-Business">
                            	<?php if(!empty($partner['image'])){?>
                            	<img title="<?php echo $partner['title']; ?>" alt="nhà cung cấp, đối tác" src="static/<?php echo $partner['image']; ?>">
                            	<?php }?>
								<h2 style="font-size: 13px;"><?php echo $partner['title']; ?></h2>
								<div><?php echo ZPartner::nl2br2($partner['location']); ?></div>
								<?php if(!empty($partner['other'])){?>
								<div style="line-height: 20px;"><?php echo ZPartner::nl2br2($partner['other']); ?></div>
								<?php }?>
								<div><a href="<?php echo $partner['homepage']; ?>" target="_blank"><?php echo domainit($partner['homepage']); ?></a></div>
								<?php include template("block_block_partnermap");?>
							</div>
						</div>
                        <div class="clear"></div>
                    </div>
                    <div class="box-bottom"></div>
                    <!--flow me at ...-->
                    <div class="box-top"></div>
                    <div class="box-content">
                    <?php if(!empty($INI['system']['twitter'])){?>
                    	<a target="_blank" href="http://twitter.com/#!/<?php echo $INI['system']['twitter']; ?>"><img width="90px" alt="flow me at twitter" src="../static/img/twitter.png"></a>
                    <?php }?>
                    <?php if(!empty($INI['system']['facebook'])){?>
                    	<a target="_blank" href="<?php echo $INI['system']['facebook']; ?>"><img width="60px" alt="flow me at facebook" src="../static/img/facebook.png"></a>
                    <?php }?>
                    	<a href="#"><img width="60px" alt="flow me at twitter" src="../static/img/rss.png"></a>
                    </div>
                    <div class="box-bottom"></div>
                    <!-- end -->
                </div>
            </div>
    </div>
    <div id="sidebar">
		<!--{//include block_side_invite}-->
		<!--{//include block_side_bulletin}-->
		<?php include template("block_side_flv");?>
		<?php include template("block_side_others_seconds");?>
		<?php include template("block_side_ask");?>
		<?php include template("block_side_send2group");?>
		<?php include template("block_side_others");?>
		<?php include template("block_side_business");?>
		<?php include template("block_side_tranfer");?>
		<!--{//include block_side_subscribe}-->
		<?php include template("block_side_twitter");?>
	</div>
</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->

<?php include template("footer");?>
